import { Directive, ElementRef } from '@angular/core';
import { Utils } from '../../index';

@Directive({
    selector: '[cmbWeixinSize]'
})
export class WeixinSizeDirective {

    constructor(element: ElementRef) {
        if (Utils.isWeixin()) {
            if (Utils.getDevice() === 'ANDROID') {
                $(element.nativeElement).height(window.screen.availHeight - 68);
            } else {
                $(element.nativeElement).height(window.screen.availHeight - 64);
            }
        } else {
            $(element.nativeElement).height(window.screen.availHeight);
        }
        $(element.nativeElement).width(window.screen.availWidth);
    }
}
